import http from './Common/http.js'
import constant from '@/controller/constant.js'
import axios from "axios"

export default {
  // 养老资讯展示分页
  pensionInformation_v1_list_frontEnd: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionInformation/v1/list/frontEnd',data)
    return res
  },
  // 资讯详情
  pensionInformation_v1_get: async function (id) {
    const res = await http.get(constant.BASE_URL + '/pensionInformation/v1/get/' + id)
    return res
  },
  // 养老服务轮播图展示
  pensionBanner_v1_list_frontEnd: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionBanner/v1/list/frontEnd', data)
    return res
  },
  // 品质服务分页展示
  pensionQuality_v1_list: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionQuality/v1/list', data);
    return res
  },
  // 品质服务搜索
  pensionQuality_v1_search: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionQuality/v1/searchFront', data)
    return res
  },
  // 住养服务分页展示
  pensionHousing_v1_list: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionHousing/v1/list', data)
    return res
  },
  // 住养服务详情
  pensionHousing_v1_get: async function (id) {
    const res = await http.get(constant.BASE_URL + '/pensionHousing/v1/get/' + id)
    return res
  },
  // 住养服务搜索
  pensionHousing_v1_search: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionHousing/v1/searchFront', data)
    return res
  },
  // 老人档案分页展示/pensionCare/v1/list
  pensionCare_v1_list: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionCare/v1/list/Front', data)
    return res
  },
  // 老人档案详情/pensionCare/v1/get/{id}
  pensionCare_v1_get: async function (id, data) {
    const res = await http.post(constant.BASE_URL + '/pensionCare/v1/get/' + id, data)
    return res
  },
  // 老人档案搜索前台/pensionCare/v1/search
  pensionCare_v1_searchFront: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionCare/v1/searchFront', data)
    return res
  },
  // 返回小区-楼栋-单元
  pensionCare_v1_lsit_neighborhood: async function () {
    const res = await http.get(constant.BASE_URL + '/pensionCare/v1/lsit/neighborhood')
    return res
  },
  // 巡查服务-获取巡查人数
  pensionRecord_v1_count: async function () {
    const res = await http.get(constant.BASE_URL + '/pensionRecord/v1/count')
    return res
  },
  // 巡查分页列表
  pensionRecord_v1_list_frontEnd: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionRecord/v1/list/frontEnd', data)
    return res
  },
  // 新增巡查
  pensionRecord_v1_create: async function (data) {
    const res = await http.post(constant.BASE_URL + '/pensionRecord/v1/create', data)
    return res
  },
  // 获取当天巡查详情
  pensionRecord_v1_get_front: async function (id) {
    const res = await http.get(constant.BASE_URL + '/pensionRecord/v1/get/front/' + id)
    return res
  },
  // 修改巡查记录
  pensionRecord_v1_update: async function (id, data) {
    const res = await http.put(constant.BASE_URL + '/pensionRecord/v1/update/' + id, data)
    return res
  },
  // 图片上传
  upload_image: function (file) {
    const formData = new FormData()
    formData.append("file", file)
    return  axios.post(process.env.VUE_APP_BASE_API + constant.BASE_URL + '/upload/image', formData)
  }
}